<template>
  <div ref="pie" style="width: 500px; height: 400px"></div>
</template>

<script>
export default {
  name: "chart",
  props: ["pie"],
  methods: {
    initEcharts() {
      let myEcharts = this.$echarts.init(this.$refs.pie);
      let option = {
        title: {
          //   text: "茶叶种类销售量",
        },
        tooltip: {
          trigger: "axis",
          axisPointer: {
            type: "shadow",
          },
        },
        /*  xAxis: {
          //   type: "category",
          //   data: [],
        },
        yAxis: {
          //   type: "value",
        }, */
        legend: {},
        series: [
          {
            // name: "星期",
            type: "pie",
            data: this.pie,
            /* [
              { value: 48, name: "Search Engine" },
              { value: 735, name: "Direct" },
              { value: 580, name: "Email" },
              { value: 484, name: "Union Ads" },
              { value: 300, name: "Video Ads" },
            ], */
            //  [23, 33, 45, 56, 78],
          },
        ],
      };
      myEcharts.setOption(option);
    },
  },
  mounted() {
    this.initEcharts();
  },
};
</script>

<style>
</style>